#include <iostream>

#include "apidemo.h"

int main(void)
{
    std::string url = "http://172.18.118.28:8858";
    JzAGVApi *api = new JzAGVApi(url);

    // 根据机器人ID获取机器人信息
    std::string robotInfo = api->GetRobot(1);
    std::cout << "robot info: " << robotInfo << std::endl;

    // 获取所有机器人信息
    std::string robotsInfo = api->GetRobots();
    std::cout << "robots info: " << robotsInfo << std::endl;

    // 创建任务
    std::string missionResp = api->CreateMission();
    std::cout << "mission resp: " << missionResp << std::endl;

    // 根据任务ID获取任务信息
    std::string missionInfo = api->GetMission(43);
    std::cout << "mission info: " << missionInfo << std::endl;

    // 根据uuid获取任务信息
    // 只有当创建任务的时候指定了ref_uuid,则可以根据uuid查询任务信息
    std::string missionInfo2 = api->GetMissionByUUID("uuid-1");
    std::cout << "mission info: " << missionInfo2 << std::endl;

    // 根据任务ID或者UUID，下发指令(如取消任务)
    std::string cancelResp = api->CreateMissionCommand(CMD_CANCEL, 44);
    std::cout << "cancel resp: " << cancelResp << std::endl;

    // // 根据下发指令响应中的指令ID查询指令执行结果
    std::string check_resp = api->CheckMissionCommand(1);
    std::cout << "check resp: " << check_resp << std::endl;

    delete api;
    return 0;
}
